package com.javasea.websocket.handler.impl;

import com.javasea.websocket.entity.JsonMessage;
import com.javasea.websocket.handler.Handler;
import com.javasea.websocket.utils.JacksonUtils;
import com.javasea.websocket.utils.WsBroadcastUtil;
import org.springframework.stereotype.Component;

import javax.websocket.Session;

/**
 * @author: Ethan_Fung
 * @description:
 * @date: 2020/3/18 16:17
 * @version: 1.0
 **/
@Component
public class GetTodoHandler implements Handler {

    @Override
    public Object action(String message, Session session) throws Exception {
        JsonMessage jsonMessage = JacksonUtils.json2pojo(message, JsonMessage.class);
        try {
            WsBroadcastUtil.broadcastNotifications(session, jsonMessage);
        } catch (Exception e) {
        }
        return null;
    }
}
